package top.zhangjianyong.blog.params.ai;

import java.util.List;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author zhangjianyong
 * @since 2025/7/7 16:37
 */
@Data
public class ChatParam {
  private List<Message> messages;

  @AllArgsConstructor
  @NoArgsConstructor
  @Data
  public static class Message {
    private String role;
    private String content;
  }

  public String userMessage() {
    return messages.stream()
        .filter(message -> "user".equals(message.getRole()))
        .map(Message::getContent)
        .collect(Collectors.joining("\n"));
  }
}
